//
//  MNCreditorDetailTopCell.m
//  minidai
//
//  Created by 谭谭伟 on 2017/5/31.
//  Copyright © 2017年 迷你金服. All rights reserved.
//

#import "MNCreditorDetailTopCell.h"
@interface MNCreditorDetailTopCell()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *progressViewWidth;
@property (weak, nonatomic) IBOutlet UIView *progressBottomView;

@end
@implementation MNCreditorDetailTopCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.discountAprLabel.layer.borderWidth = 1.0f;
    self.discountAprLabel.layer.borderColor = [UIColor colorWithRed:255/255.0 green:110/255.0 blue:63/255.0 alpha:1.0].CGColor;
    self.discountAprLabel.layer.cornerRadius = 3.0f;
    self.discountAprLabel.clipsToBounds = YES;
    // Initialization code
}

- (void)setDetaiModel:(MNDFinaceDetailModel *)detaiModel {
    _detaiModel = detaiModel;
    self.borrowTitleLabel.text = self.detaiModel.borrow_title;
    self.borrowYearAprLabel.text = self.detaiModel.borrow_year_apr;
    self.borrowDeadlineLabel.text = [NSString stringWithFormat:@"%@个月",self.detaiModel.creditor_deadline];
    self.leastTenderMoneyLabel.text = [NSString stringWithFormat:@"%zd元起投",self.detaiModel.creditor_least_tender_money.integerValue];
    self.creditorPrincipalLabel.text = [NSString stringWithFormat:@"%@",self.detaiModel.creditor_principal];
    self.creditorAmountMoneyLabel.text = [NSString stringWithFormat:@"剩余可承接债权%@元",self.detaiModel.creditor_remainingable_money];
    self.creditorWorthLabel.text = [NSString stringWithFormat:@"%@",self.detaiModel.creditor_worth];
    self.borrowMoneyLabel.text = [NSString stringWithFormat:@"%@",self.detaiModel.borrow_money];
    NSString *progressStr = self.detaiModel.creditor_nowProgress;
    NSInteger number = progressStr.integerValue;
    CGFloat number1 = number/100.0;
    self.progressViewWidth.constant = self.progressBottomView.bounds.size.width*number1;
    self.backWayLabel.text = self.detaiModel.back_way;
    self.borrowStartDateLabel.text = self.detaiModel.creditor_start_date;
    self.borrowReleaseTimeLabel.text = self.detaiModel.creditor_add_time;
    if (self.detaiModel.borrow_deadline.integerValue > 2) {
        [self.transferConditionButton setTitle:@"满60天后可转" forState:UIControlStateNormal];
    }else {
        [self.transferConditionButton setTitle:@"短期标不可转" forState:UIControlStateNormal];
    }
    if (self.detaiModel.creditor_nowProgress) {
        NSString *precent = @"%";
        self.progressLabel.text = [NSString stringWithFormat:@"%@%@",self.detaiModel.creditor_nowProgress,precent];
    }
    
    
//    [self configContents];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
